<?php
/**
 *
 * 功能描述（蛋糕评价数据）
 *
 * @author suoya <jlusuoya@gmail.com>
 * @version 1
 */

class ModelComment extends ModelBase
{
	public $key_eq = array(
		'goods_id' => true,
		'user_id' => true,
	);		//精确搜索关键字
	public $key_cover = array(
		'c_start' => 'createtime >=',
		'c_end' => 'createtime <=',
	);	//转换搜索关键字
	function GetList(&$search, &$pageinfo)
	{
		$where = get_where($this, $search);
		$data  = $this->db->getRow("goods_comment", 'count(1) cnt', $where);
		if($data['cnt'] == 0)
		{
			$this->DealPage($pageinfo, 0);
			return array();
		}
		$limit = $this->DealPage($pageinfo, $data['cnt']);
		$fild = "`id`, `goods_id`, `user_id`, `size`, `visible`, `version`, `user_id`, `username`, `createtime`, `content`, `taste`, `service`, `whole`";
		$data = $this->db->GetAll("goods_comment", $fild, $where, 'createtime desc', $limit);
		return $data;
	}

	function Update($id, $data)
	{
		$cnt = $this->db->Update('goods_comment', $data, "id = $id");
		return $cnt;
	}
}

